const R = require("@common/r");
const Dict = require('@models/dict');

const routes = (router, pre, app) => {
  // 获取字典列表
  router.get(`${pre}/list`, async (req, res) => {
    const list = await Dict.findAll();
    const obj = {};
    list.map(item => obj[item.type] = list.filter(v => v.type === item.type));
    res.json(R.ok(obj, '获取成功'));
  })
};

module.exports = routes;